package cn.tedu.mydemomvchighly.dao.persist.repository.impl;

import cn.tedu.mydemomvchighly.dao.persist.mapper.UserMapper;
import cn.tedu.mydemomvchighly.dao.persist.repository.IUserRepository;
import cn.tedu.mydemomvchighly.pojo.entity.User;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class UserRepositoryImpl implements IUserRepository {

    @Autowired
    UserMapper userMapper;

    @Override
    public int insert(User user) {

        userMapper.insert(user);
        return 0;
    }

    @Override
    public int getUserInfo(String name) {
//        userMapper.selectList()
        return 0;
    }

    @Override
    public List<User> getUsers() {

        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.gt("id",-1);

        List<User> users = userMapper.selectList(queryWrapper);

        return users;
    }


}
